package com.goods.business.converter;

import com.goods.common.model.business.ProductCategory;
import com.goods.common.model.system.Role;
import com.goods.common.vo.business.ProductCategoryTreeNodeVO;
import com.goods.common.vo.system.RoleVO;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Title:
 * Author: fusu
 * DateTime:  2023/3/24
 * Description:
 **/
public class ProductCategoryConverter {

    /**
     * 转vo
     *
     * @param
     * @return
     */
    public static List<ProductCategoryTreeNodeVO> converterToProductCategoryTreeNodeVOList(List<ProductCategory> productCategoryList) {
        List<ProductCategoryTreeNodeVO> ProductCategoryTreeNodeVOs = new ArrayList<>();
        if (!CollectionUtils.isEmpty(productCategoryList)) {
            for (ProductCategory productCategory : productCategoryList) {
                ProductCategoryTreeNodeVO productCategoryTreeNodeVO = new ProductCategoryTreeNodeVO();
                BeanUtils.copyProperties(productCategory, productCategoryTreeNodeVO);
                ProductCategoryTreeNodeVOs.add(productCategoryTreeNodeVO);
            }
        }
        return ProductCategoryTreeNodeVOs;
    }
}
